package com.xiaojian.pick.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 前端用户类
 */
@Data
public class User {
    // 用户信息完整度状态
    // 用户信息不完整
    public static final String NOT_USER_INFO = "0";
    // 用户信息已部分完整
    public static final String HAVE_USER_INFO = "1";
    // 用户信息完整
    public static final String ALL_USER_INFO = "2";

    private Integer id;  // id
    private String openid;  // 微信小程序用户 openid
    private String nickName;    // 用户昵称
    private String avatarUrl;   // 用户头像
    private Byte gender;    // 性别
    private String country; // 国家
    private String province;    // 省份
    private String city;    // 城市
    private String haveUserInfo;    // 是否已获取用户信息

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;    // 创建时间

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;    // 更新时间

    private String qqNum;   // 预留 QQ号
    private String wechatNum;      // 预留 微信号

    public User(Integer id, String openid, String nickName, String avatarUrl, Byte gender, String country, String province, String city, String haveUserInfo, Date createTime, Date updateTime, String qqNum, String wechatNum) {
        this.id = id;
        this.openid = openid;
        this.nickName = nickName;
        this.avatarUrl = avatarUrl;
        this.gender = gender;
        this.country = country;
        this.province = province;
        this.city = city;
        this.haveUserInfo = haveUserInfo;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.qqNum = qqNum;
        this.wechatNum = wechatNum;
    }

    public User() {
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", openid='" + openid + '\'' +
                ", nickName='" + nickName + '\'' +
                ", avatarUrl='" + avatarUrl + '\'' +
                ", gender=" + gender +
                ", country='" + country + '\'' +
                ", province='" + province + '\'' +
                ", city='" + city + '\'' +
                ", haveUserInfo='" + haveUserInfo + '\'' +
                ", createTime=" + createTime +
                ", updateTime=" + updateTime +
                ", qqNum='" + qqNum + '\'' +
                ", wechatNum='" + wechatNum + '\'' +
                '}';
    }

    public static String getNotUserInfo() {
        return NOT_USER_INFO;
    }

    public static String getHaveUserInfo() {
        return HAVE_USER_INFO;
    }

    public void setHaveUserInfo(String haveUserInfo) {
        this.haveUserInfo = haveUserInfo;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public String getQqNum() {
        return qqNum;
    }

    public void setQqNum(String qqNum) {
        this.qqNum = qqNum;
    }

    public String getWechatNum() {
        return wechatNum;
    }

    public void setWechatNum(String wechatNum) {
        this.wechatNum = wechatNum;
    }

    public static String getAllUserInfo() {
        return ALL_USER_INFO;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getOpenid() {
        return openid;
    }

    public void setOpenid(String openid) {
        this.openid = openid;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getAvatarUrl() {
        return avatarUrl;
    }

    public void setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
    }

    public Byte getGender() {
        return gender;
    }

    public void setGender(Byte gender) {
        this.gender = gender;
    }

    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }
}